#pragma once

#include "Types.h"
#include "DLL.h"
#include "Doc.h"
#include "Panels.h"
#include "Splitters.h"
#include "DisplayPanel.h"

#include <MyFC/CustomWindow.h>

namespace My {

class DLL_API Frame : public CustomWindow<CFrameWnd>
{
	typedef My::CustomWindow<CFrameWnd> Base;
	friend class ToolPanelBar;
	friend class RightPanelBar;
	friend class BottomPanelBar;
	friend class RightSplitter;
	friend class BottomSplitter;
	friend class CornerGrip;
	friend class RightGrip;
	friend class BottomGrip;
	friend class DisplayPanel;
public:
	typedef CWnd ViewType;
	enum { ResourceID = 0 };
public:
	Frame(Doc &);
	virtual ~Frame();
public:
	Doc & GetDoc()
		{ return m_Doc; }
	PanelBar & GetToolBar();
	PanelBar & GetRightBar();
	PanelBar & GetBottomBar();
	DisplayPanel & GetDisplayPanel();
	bool IsStatusBarVisible() const;
	bool IsRightVisible() const;
	bool IsBottomVisible() const;
	bool IsBottomFixedSize() const;
public:
	void SetSplit(int rs, int bs, bool rv, bool bv);
	void ToggleRightVisible();
	void ToggleBottomVisible();
	void SetBottomFixedSize(bool Fixed);
	void UpdateTitle();
public:
	virtual CSize GetPreferredViewSize();
	virtual CWnd & GetView() { return * ((CWnd *) 0); }
// Overrides
public:
	virtual bool CanGetFocus() const
		{ return true; }
	virtual void HandleFocus();
	virtual BOOL PreCreateWindow(CREATESTRUCT &);
	virtual void RecalcLayout(BOOL bNotify = TRUE);
	virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);
	virtual const CFont * Font() const;
	virtual void ProcessEvent(Event &);
protected:
	virtual void PostNcDestroy();
// Message map 
public:
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnDestroy();
	afx_msg void OnClose();
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	afx_msg LRESULT OnMessage(WPARAM, LPARAM);
	afx_msg void OnSetFocus(CWnd *);
	afx_msg void OnViewRightPanels();
	afx_msg void OnUpdateViewRightPanels(CCmdUI* pCmdUI);
	afx_msg void OnViewBottomPanels();
	afx_msg void OnUpdateViewBottomPanels(CCmdUI* pCmdUI);
	DECLARE_MESSAGE_MAP()
private:
	Doc &			m_Doc;
	int				m_RightSplit;
	int				m_BottomSplit;
	bool			m_RightVisible;
	bool			m_BottomVisible;
	bool			m_RightAutoHide;
	bool			m_BottomAutoHide;
	ToolPanelBar	m_ToolBar;
	RightPanelBar	m_RightBar;
	BottomPanelBar	m_BottomBar;
	DisplayPanel	m_DisplayPanel;
	bool			m_BottomFixedSize;
	RightSplitter	m_RightSplitter;
	BottomSplitter	m_BottomSplitter;
	CornerGrip		m_CornerGrip;
	RightGrip		m_RightGrip;
	BottomGrip		m_BottomGrip;
	CStatusBar		m_StatusBar;
	CFont			m_Font;
};

} // My

#include "Impl/Frame.inl"
